﻿using System;
using System.Data;
using System.Data.Common;

namespace MediaBrowserSL.DAL.Contexts
{
    /// <summary>
    /// Db Parameter Generique
    /// </summary>
    public static class GenericParameterProc
    {
        /// <summary>
        /// Create Generic parameter
        /// </summary>
        /// <param name="command"></param>
        /// <param name="parameterName"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static DbParameter CreateParameter(DbCommand command, String parameterName, Object value, DbType type)
        {
            DbParameter param = command.CreateParameter();
            param.Value = (value == null) ? DBNull.Value : value;
            param.ParameterName = parameterName;
            param.DbType = type;
            return param;
        }
    }
}
